package 函数式编程.imooc函数思想

object try表达式 {
  def main(args: Array[String]): Unit = {
    /**
     * try{}
     * catch{}
     * finally{}
     */
    val res_try = try {
      Integer.parseInt("dog")
    }
    catch {
      case _: Throwable => 0
    }
    finally println("always be printed")

    println(res_try)

    val code = 3
    code match {
      case 1 => println("one")
      case 2 => println("two")
      case _ => println("other")
    }

  }

  def add2(x: Int)(y: Int): Int = {
    x + y
  }

  //科里化的好处,在不增加函数的请款下拓展函数的功能
  private val addOne = add2(1) _

}
